package java.com.codingmanage.dao.hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class SessionFactoryUtils {

	private static SessionFactoryUtils sessionFactory=null;
	private SessionFactory sf=null;
	
	public static SessionFactoryUtils getInvocation(){
		if(sessionFactory==null)
			sessionFactory=new SessionFactoryUtils();
		return sessionFactory;
	}
	
	public org.hibernate.SessionFactory getSessionFactory(){
		return getMySessionFactory();

	}

	private org.hibernate.SessionFactory getMySessionFactory() {
		if(sf==null){
			Configuration configuration = new Configuration().configure("/hibernate-mysql.cfg.xml");
			sf = configuration.buildSessionFactory();
		}
		return sf;
	}
	
}
